import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

public class DictServer extends Server{
    private Map<String , String> dict = new HashMap<>();

    public DictServer(int port) throws SocketException {
        super(port);

        dict.put("dog" , "小狗");
        dict.put("cat" , "小猫");
    }

    //重写process方法

    @Override
    public String process(String request) {
         return dict.getOrDefault(request, "该词在词典中不存在");

    }

    public static void main(String[] args) throws IOException {
        DictServer server  = new DictServer(9090);
        server.start();
    }
}
